package com.clw.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;

import com.clw.bean.Chexingfenlei;
import db_Util.ConnectHelper;

public class ChexingfenleiDao {

	public ArrayList<Chexingfenlei> query() {
		ArrayList<Chexingfenlei> chexingfenleiArr = new ArrayList<Chexingfenlei>();
		ConnectHelper ch = new ConnectHelper();
		Connection conn = ch.openConnection();
		try {
			PreparedStatement ps = conn.prepareStatement("select * from t_chexingfenlei where h_id=1");
			ResultSet rs = ps.executeQuery();
			while (rs.next()) {
				Chexingfenlei chexingfenlei = new Chexingfenlei();
				chexingfenlei.setName(rs.getString("name"));
				chexingfenlei.setValue(rs.getInt("value"));
				chexingfenleiArr.add(chexingfenlei);
			}
			conn.close();
		} catch (SQLException e) {
			e.printStackTrace();
		} 
	       return chexingfenleiArr;
	}
}
